<template>
  <div>
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>新增日报</span>
        <el-button @click="backUserList" style="float: right; padding: 3px 0" type="text">返回日报列表</el-button>
      </div>
      <div>
        <el-form ref="form" :model="form" label-width="80px">
          <el-form-item label="工作内容" prop="form.work_content">
            <el-input style="width: 300px"
                      v-model="form.work_content"
                      type="textarea"
                      :rows="2"></el-input>

          </el-form-item>
          <el-form-item label="明日计划" prop="form.tomorrow_plan">
            <el-input style="width: 300px" v-model="form.tomorrow_plan"
                      type="textarea"
                      :rows="2"></el-input>
          </el-form-item>
          <el-form-item label="工作进度" prop="form.work_process">
            <div class="block" style="width: 500px">
              <el-slider
                      v-model="form.work_process"
                      :step="10">
              </el-slider>
            </div>
          </el-form-item>
          <el-form-item label="问题" prop="form.problem">
            <el-input style="width: 300px" v-model="form.problem"
                      type="textarea"
                      :rows="2"></el-input>
          </el-form-item>
          <el-form-item label="备注" prop="form.other">
            <el-input style="width: 300px" v-model="form.other"
                      type="textarea"
                      :rows="2"></el-input>
          </el-form-item>
        </el-form>
        <el-button @click="submit" type="primary">提交日报</el-button>
      </div>
    </el-card>

  </div>
</template>

<script>
  import {addDaily} from "../../network/Daily";

  export default {
    name: "DailyAdd",
    data() {
      return {
        form: {
          other:'',
          problem:'',
          tomorrow_plan:'',
          work_content:'',
          work_process:''
        }
      }
    },
    methods: {
      backUserList() {
        this.$router.back(1)
      },
      submit() {
        console.log(this.form)
        addDaily(this.form).then(res => {
          this.$message.success('添加日报成功')
          setTimeout(() => {
            this.$router.back(1)
          }, 500)
        }, err => {
          this.$message.error('添加日报失败，请检查错误')
        })
      }
    },
    beforeMount() {
    }
  }
</script>

<style scoped>

</style>
